

printf("Key test program.\nPress a single key on your keyboard to gain details on it.\n");
printf("Press CTRL+L to exit\n");
local lastKeyPressed = 0;

while(true) do
	for i = 0,255 do
		if( keyPressed(i) ) then
			if( i ~= lastKeyPressed ) then
				local str = sprintf("Key: %d [%s]\t\t", i, getKeyName(i));
				printf("\r%s", str);
				lastKeyPressed = i;
			end
		end
	end

	yrest(10);

	if( keyPressed(key.VK_CONTROL) and keyPressed(key.VK_L) ) then
		break;
	end
end